'use strict';

let { Sequelize, DataTypes } = require("sequelize");


let sequelize = new Sequelize("zzy", "postgres", "qq_112358", {
    host: "172.16.10.214",
    dialect: "postgres"
});

let defineModel = (name, obj) => {
    let attrs = {};

    attrs.id={
        type:DataTypes.BIGINT,
        primaryKey:true,
        autoIncrement: true
    }

    for(let key in obj){
        attrs[key]=obj[key];
    }

    attrs.remarks={
        type:DataTypes.STRING(300),
    }

    let User = sequelize.define(name, attrs);
    return User;
};

let obj = {
    sequelize,
    defineModel,
    DataTypes
}

module.exports = obj;